﻿#include "mainwindow.h"
#include "ui_mainwindow.h"

#include <qfiledialog.h>

MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    this->setWindowTitle("Qt image viewer v1.0");
}

MainWindow::~MainWindow()
{
    delete ui;
}

void MainWindow::on_action_open_picture_triggered()
{
    QString file = QFileDialog::getOpenFileName(this, "打开图片", "C:", "*.png *.jpg *.jpeg");
    if(!file.isEmpty()) {
        ui->centralWidget->loadImage(file);
    }
}
